#include "lvgldesigner.h"

pLvObject  LVGLDesigner::screen = 0;
pLvObject  LVGLDesigner::main_ctx = 0;
erpc_transport_t LVGLDesigner::transport = nullptr;
QMap<lv_obj_t*, pLvObject> LVGLDesigner::lvObj_map;

LVGLDesigner::LVGLDesigner()
{

}

void LVGLDesigner::registerObject(lv_obj_t *lv_obj, pLvObject pObj)
{
    lvObj_map.insert(lv_obj, pObj);
}

void LVGLDesigner::removeObject(lv_obj_t *lv_obj)
{
    if (lvObj_map.contains(lv_obj)) {
        lvObj_map.remove(lv_obj);
    }
}

pLvObject LVGLDesigner::findObject(lv_obj_t *lv_obj)
{
    if (lvObj_map.contains(lv_obj)) {
        return lvObj_map.value(lv_obj);
    }
    return 0;
}
